
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html>
<head>
	<meta charset='utf-8' /> 
	<title>台账管理</title>
	<style>
		.cursers{cursor:pointer}
	</style>
</head>
<body style='background:#ddd;padding:0px;margin:0px;padding-left:10px'>
	<div style='border:0px solid;font:normal normal 12px/30px normal'>


		<div style='float:right;padding-right:10px'>
			<span onclick='location.href="password.html"' class='cursers'>
				<a href='ledger_create.html' style='text-decoration:none'>创建新台账</a>　
				<span >当前账号：<span style='color:#229' id='account'>a</span>　</span>
			</span>
			　
			<span style='color:blue' class='cursers' onclick='exit()'>退出</span>　
		</div>
		<div style='clear:both'></div>
	</div>

	<div>
		<h1 style='text-align:center'>台账列表</h1>		
	</div>

	<!--台账项目列表-->
	<div id='ledgerList' style='text-align:center'>

		<span style='display:inline-block;padding:5px 10px;border:1px solid #ccc;margin:10px 20px'>aaa</span>
	</div>
	<div style='clear:both'></div>

</body>
</html>
<script src='../public/jquery1.1.js'></script>
<script src='../public/fun.js'></script>
<script>
_checkExit();


$(function(){
	$('#account').text(sessionStorage.ledgerAccount);

	_getLedgerList();

});


function _getLedgerList(){
	var data = {
		type:'_getLedgerList'
	}
	AjaxBefore(data,function(res){
		var tmp = _checkJsonFormat(res); //检测JSON格式
		_parseData(tmp.data);
	});
}

function _parseData(data){
	var tmp_str = '';
	if(data.length > 0){
		for(var i=0;i<data.length;i++){
			C(data[i]);
			tmp_str += "<span style='display:inline-block;padding:5px 10px;border:1px solid #ccc;margin:10px 20px;cursor:pointer' onclick=_jumpDetail(" + data[i].id + ",'" + data[i].name + "','" + data[i].tname + "') title='" + data[i].info + "'>" + data[i].name + "</span>";
		}
	}else{
		tmp_str = '<h2 style="color:red">暂无数据</h2>';
	}
	$('#ledgerList').html(tmp_str);
}

function _jumpDetail(id,name,tname){
	sessionStorage.ledgerCurrentId = id;
	sessionStorage.ledgerCurrentName = name;
	sessionStorage.ledgerCurrentTname = tname;
	location.href='ledger_detail.html';
}

</script>

